<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@page import="com.gdit.zax.utils.UrlDecoder"%>
<%@page import="java.sql.Connection"%>
<%@page import="com.gdit.zax.utils.DBUtil"%>
<%@page import="com.gdit.zax.utils.Repost"%>
<%@page import="com.gdit.zax.dao.SchoolDao"%>
<%@page import="com.gdit.zax.factory.DAOFactory"%>
<%
	Connection conn = DBUtil.getConnection();
	if (conn==null) {
		Repost.dberror(request,response);
		return;
	}
	
	SchoolDao school = DAOFactory.init(conn,request,response).getSchoolDao();
	request.setAttribute("data",school.getAllSchool());
 %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">



<html>
	<head>
		<title>首页！</title>
	</head>
	<body>

		<table align="center">
			<tr>
				<td>
					<form action="servlet_login" method="post">
						用户登录<br><br>
						学校：
			<select name="schoolid">
				<option value="-1" selected="selected">请选择学校</option>
				<c:forEach var="list" items="${requestScope.data}" varStatus="index">
					<c:choose>
						<c:when test="${index.index == -1 }">
							<option value="${list.id}" selected="selected">
								${list.name}
							</option>
						</c:when>
						<c:otherwise>
							<option value="${list.id}">
								${list.name}
							</option>
						</c:otherwise>
					</c:choose>
				</c:forEach>
			</select>
				<br>
						账号:
						<input type="text" name="name"><br><br> 
						密码: <input type="password" name="pwd"><br><br>
						身份：<select name="juese">
						<option value ="0" selected="selected">用户</option>
						<option value ="10">教师</option>
						<option value ="20">管理员</option>
                </select>
						<br><br>
						
						<input type="submit" value="登录">
						<input type="reset" value="重置">
						<br>
						<br>
						<a href="register.jsp" target="right">注册新用户</a></br>
					</form>
				</td>
			</tr>
		</table>
		<!-- 跳到新页面，因为当前页面没有名叫“left”的frame -->
	</body>
</html>